﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Tracuudiem.aspx.cs" Inherits="webtracuudiem.Tracuudiem" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .auto-style2 {
            font-size: x-large;
            color: #FF3300;
            text-align: center;
            background-color: #FF9933;
        }
        .auto-style1 {
            width: 100%;
        }
        .auto-style32 {
            width: 17%;
        }
        .auto-style33 {
            width: 2%;
        }
        .auto-style34 {}
        .auto-style45 {
            font-size: large;
        }
        .auto-style46 {
            width: 225px;
        }
        .auto-style47 {
            width: 48px;
        }
        </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table class="auto-style1">
        <tr>
            <td class="auto-style2" colspan="2"><strong id="labtracuudiem">SINH VIÊN TRA CỨU ĐIỂM</strong></td>
            <td class="auto-style32">
                <asp:Button ID="ButThoat" runat="server" Text="Đăng xuất" Width="97px" OnClick="ButThoat_Click" />
            </td>
            <td class="auto-style33">&nbsp;</td>
        </tr>
        <tr>
            <td colspan="4"><span class="auto-style45">Thông tin sinh viên</span><br />
                MaSV :
                <asp:Label ID="lblMaSV" runat="server"></asp:Label>
                <br />
                Họ tên :
                <asp:Label ID="lblHoten" runat="server"></asp:Label> &nbsp;
                <br />

                Ngày sinh :
                <asp:Label ID="lblNgaysinh" runat="server"></asp:Label>
                <br />
                Lớp :
                <asp:Label ID="lblLop" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="auto-style46">Xem điểm theo học kỳ (Chọn học kỳ) :</td>
            <td class="auto-style47">
                <asp:DropDownList ID="DropHocky" runat="server" Height="22px" style="margin-left: 5px" Width="109px">
                    <asp:ListItem>1</asp:ListItem>
                    <asp:ListItem>2</asp:ListItem>
                    <asp:ListItem>3</asp:ListItem>
                    <asp:ListItem>4</asp:ListItem>
                </asp:DropDownList>
                <br />
                </td>
            <td class="auto-style32">
                <asp:Button ID="ButXemdiem" runat="server" Text="Xem Điểm" OnClick="ButXemdiem_Click" />
            </td>
        </tr>
        <tr>
            
            <td colspan="4" >
                &nbsp;<asp:Button ID="ButXemdiemtoankhoa" runat="server" Text="Xem Điểm Toàn Khóa" OnClick="ButXemdiemtoankhoa_Click" />
            </td>
        </tr>
           <tr>
            <td colspan="4">
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Visible="False" OnRowDataBound="GridView1_RowDataBound" ShowFooter="True">
                    <Columns>
                        <asp:BoundField HeaderText="MaMH" DataField="MaMH" SortExpression="MaMH" />
                        <asp:BoundField HeaderText="TenMH" DataField="TenMH" SortExpression="TenMH" />
                        <asp:BoundField HeaderText="HocKy" DataField="hocky" SortExpression="hocky" />
                        <asp:BoundField DataField="DiemL1" HeaderText="DiemL1" SortExpression="DiemL1" />
                        <asp:BoundField DataField="DiemL2" HeaderText="DiemL2" SortExpression="DiemL2" FooterText="Diem trung binh" />
                        <asp:BoundField DataField="DiemKQ" HeaderText="DiemKQ" SortExpression="DiemKQ" />
                    </Columns>                    
                </asp:GridView>
                 <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Demo1ConnectionString %>" SelectCommand="SELECT tam.MaMH,TenMH,hocky,DiemL1,DiemL2,DiemKQ
FROM (SELECT  mn.MaMH,TenMH,HocKy
      FROM    Lop l,SinhVien sv,NganhHoc nh, MonHocCuaNganh mn,MonHoc mh
      where   l.MaLop=sv.MaLop AND l.MaNganh=nh.MaNganh and nh.MaNganh=mn.MaNganh and mh.MaMH=mn.MaMH
      and  sv.MaSV=@MASV and HocKy=@HOCKY) as tam
LEFT JOIN (select * from Diem where MaSV=@MASV) as tam2
ON tam.mamh = tam2.MaMH">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="lblMaSV" Name="MASV" PropertyName="Text" />
                        <asp:ControlParameter ControlID="DropHocky" Name="HOCKY" PropertyName="SelectedValue" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
        </tr>

        <tr>
            <td class="auto-style34" colspan="4">
                <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource2" Visible="False" OnRowDataBound="GridView2_RowDataBound" ShowFooter="True">
                    <Columns>
                        <asp:BoundField HeaderText="MaMH" DataField="MaMH" SortExpression="MaMH" />
                        <asp:BoundField HeaderText="TenMH" DataField="TenMH" SortExpression="TenMH" />
                        <asp:BoundField HeaderText="HocKy" DataField="hocky" SortExpression="hocky" />
                        <asp:BoundField DataField="DiemL1" HeaderText="DiemL1" SortExpression="DiemL1" />
                       <asp:BoundField DataField="DiemL2" FooterText="Diem trung binh" HeaderText="DiemL2" SortExpression="DiemL2" />
                        <asp:BoundField DataField="DiemKQ" HeaderText="DiemKQ" SortExpression="DiemKQ" />
                    </Columns>                    
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td colspan="4">
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:Demo1ConnectionString %>" SelectCommand="SELECT tam.MaMH,TenMH,hocky,DiemL1,DiemL2,DiemKQ
FROM (SELECT  mn.MaMH,TenMH,HocKy
      FROM    Lop l,SinhVien sv,NganhHoc nh, MonHocCuaNganh mn,MonHoc mh
      where   l.MaLop=sv.MaLop AND l.MaNganh=nh.MaNganh and nh.MaNganh=mn.MaNganh and mh.MaMH=mn.MaMH
      and  sv.MaSV=@MASV) as tam
LEFT JOIN (select * from Diem where MaSV=@MASV) as tam2
ON tam.mamh = tam2.MaMH">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="lblMaSV" Name="MASV" PropertyName="Text" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
             </table>
</asp:Content>
